/***************************************************************************
*   Copyright (C) 2007 by Yuri Ovcharenko                                 *
*   amwsoft@gmail.com                                                     *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/
#include "aboutdialog.h"

#include <QtGui>

AboutDialog::AboutDialog( QWidget *parent, const QIcon & icon, const QString & title, const QString & text, const QString & license )
		: QDialog( parent )
{
	QVBoxLayout *lv;
	QHBoxLayout *lh;

	setWindowIcon(icon);
	setWindowTitle(title);

	lv = new QVBoxLayout(this);

	lh = new QHBoxLayout();
	lv->addLayout(lh);

	if (!icon.isNull()) {
		QVBoxLayout *l = new QVBoxLayout();
		lh->addLayout(l);
		QLabel *iconLabel = new QLabel();
		iconLabel->setPixmap(QPixmap(icon.pixmap(icon.actualSize(QSize(64, 64)))));
		l->addWidget(iconLabel);
		l->addItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
	}

	QTabWidget *tabs = new QTabWidget();
	lh->addWidget(tabs);

	tabs->addTab(new QLabel(text), tr("About"));

	if (!license.isEmpty()) {
		QTextEdit *edit = new QTextEdit();
		edit->setReadOnly(true);
		edit->setFont(QFont("Fixed", 10));
		edit->setLineWrapMode(QTextEdit::NoWrap);
		edit->setText(license);
		tabs->addTab(edit, tr("License"));
	}

	lh = new QHBoxLayout();
	lv->addLayout(lh);

	lh->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
	QPushButton *b = new QPushButton(tr("OK"));
	connect(b, SIGNAL(clicked()), this, SLOT(accept()));
	lh->addWidget(b);
	lh->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
}

AboutDialog::~AboutDialog()
{
}

/* End of file */
